package com.summer.framework.common.constant;

import org.apache.commons.lang3.StringUtils;

/**
 * @auther: 杨杰
 * @date: 2019/5/14 17:39
 * @description:
 */
public class RedisConstant {

    public static final String COLON = ":";

    /**
     * 失效时间
     */
    public static final Integer SHORT_TIME_OUT = 600;

    public static final Integer NORM_TIME_OUT = 1800;

    public static final Integer LONG_TIME_OUT = 3600;

    public static final String USER_NAME = "user:name";

    public static final String USER_ID = "user:id";


    public static String concat(String... keys) {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < keys.length; i++) {
            if (!StringUtils.isEmpty(keys[i])) {
                builder.append(keys[i]);
                if (i < keys.length - 1) {
                    builder.append(COLON);
                }
            }
        }
        return builder.toString();
    }

}
